<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Main</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Main' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="index.html">inter</a></li><li><a href="index.html#1">Chapter 1: Outside of inform7</a></li><li><b>Main</b></li></ul></div>
<p class="purpose">A command-line interface for Inter functions which are not part of the normal operation of the Inform compiler.</p>

<ul class="toc"><li><a href="1-mn.html#SP1">&#167;1. Settings variables</a></li><li><a href="1-mn.html#SP2">&#167;2. Main routine</a></li><li><a href="1-mn.html#SP2_6">&#167;2.6. Command line</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Settings variables.</b>The following will be set at the command line.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">pathname</span><span class="plain-syntax"> *</span><span class="identifier-syntax">path_to_inter</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">pathname</span><span class="plain-syntax"> *</span><span class="identifier-syntax">kit_to_build</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">pathname</span><span class="plain-syntax"> *</span><span class="identifier-syntax">domain_path</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">inter_file_list</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">; </span><span class="comment-syntax"> of </span><span class="extract"><span class="extract-syntax">filename</span></span>
<span class="reserved-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">output_file</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">dictionary</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pipeline_vars</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pipeline_as_file</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pipeline_as_text</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">pathname</span><span class="plain-syntax"> *</span><span class="identifier-syntax">internal_path</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">output_format</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">; </span><span class="comment-syntax"> for any </span><span class="extract"><span class="extract-syntax">-o</span></span><span class="comment-syntax"> output</span>
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">tracing</span><span class="plain-syntax"> = </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Main::add_pipeline_variable</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">Main::add_pipeline_variable</span></span>:<br/><a href="1-mn.html#SP2_3">&#167;2.3</a>, <a href="1-mn.html#SP3_1">&#167;3.1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">value</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><a href="../foundation/4-sm.html#SP17" class="function-link"><span class="function-syntax">Str::copy</span></a><span class="plain-syntax">(</span><a href="../foundation/2-dct.html#SP9" class="function-link"><span class="function-syntax">Dictionaries::create_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pipeline_vars</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">), </span><span class="identifier-syntax">value</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Main::add_pipeline_variable_from_filename</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">Main::add_pipeline_variable_from_filename</span></span>:<br/><a href="1-mn.html#SP2_3">&#167;2.3</a>, <a href="1-mn.html#SP2_4">&#167;2.4</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="reserved-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">F</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">fullname</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">fullname</span><span class="plain-syntax">, </span><span class="string-syntax">"%f"</span><span class="plain-syntax">, </span><span class="identifier-syntax">F</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="1-mn.html#SP1" class="function-link"><span class="function-syntax">Main::add_pipeline_variable</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="identifier-syntax">fullname</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">fullname</span><span class="plain-syntax">)</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. Main routine.</b>When Inter is called at the command line, it begins at <span class="extract"><span class="extract-syntax">main</span></span>, like all C
programs.
</p>

<p class="commentary">Inter can do three different things: build a kit, run a pipeline of
code generation stages, and verify/transcode files of Inter code. In fact,
though, that's really only two different things, because kit-building is
also done with a pipeline.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">main</span><span class="plain-syntax">(</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">argc</span><span class="plain-syntax">, </span><span class="reserved-syntax">char</span><span class="plain-syntax"> **</span><span class="identifier-syntax">argv</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="1-mn.html#SP2_1" class="named-paragraph-link"><span class="named-paragraph">Start up the modules</span><span class="named-paragraph-number">2.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="1-mn.html#SP2_2" class="named-paragraph-link"><span class="named-paragraph">Begin with an empty file list and variables dictionary</span><span class="named-paragraph-number">2.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="1-mn.html#SP2_6" class="named-paragraph-link"><span class="named-paragraph">Read the command line</span><span class="named-paragraph-number">2.6</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="../foundation/3-pth.html#SP3" class="function-link"><span class="function-syntax">Pathnames::set_path_to_LP_resources</span></a><span class="plain-syntax">(</span><a href="1-mn.html#SP6" class="function-link"><span class="function-syntax">Main::internal_path</span></a><span class="plain-syntax">());</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">kit_to_build</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="1-mn.html#SP2_3" class="named-paragraph-link"><span class="named-paragraph">Select the build-kit pipeline</span><span class="named-paragraph-number">2.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="1-mn.html#SP2_4" class="named-paragraph-link"><span class="named-paragraph">Run the pipeline</span><span class="named-paragraph-number">2.4</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="1-mn.html#SP2_5" class="named-paragraph-link"><span class="named-paragraph">Shut down the modules</span><span class="named-paragraph-number">2.5</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="../foundation/3-em.html#SP1" class="function-link"><span class="function-syntax">Errors::have_occurred</span></a><span class="plain-syntax">()) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">1</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2_1" class="paragraph-anchor"></a><b>&#167;2.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Start up the modules</span><span class="named-paragraph-number">2.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><a href="../foundation/1-fm.html#SP8" class="function-link"><span class="function-syntax">Foundation::start</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">argc</span><span class="plain-syntax">, </span><span class="identifier-syntax">argv</span><span class="plain-syntax">); </span><span class="comment-syntax"> must be started first</span>
<span class="plain-syntax">    </span><a href="1-lm.html#SP3" class="function-link"><span class="function-syntax">LiterateModule::start</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="../arch-module/1-am.html#SP3" class="function-link"><span class="function-syntax">ArchModule::start</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="../bytecode-module/1-bm.html#SP3" class="function-link"><span class="function-syntax">BytecodeModule::start</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="../building-module/1-bm2.html#SP3" class="function-link"><span class="function-syntax">BuildingModule::start</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="../pipeline-module/1-pm.html#SP3" class="function-link"><span class="function-syntax">PipelineModule::start</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="../final-module/1-fm2.html#SP3" class="function-link"><span class="function-syntax">FinalModule::start</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="../index-module/1-im.html#SP2" class="function-link"><span class="function-syntax">IndexModule::start</span></a><span class="plain-syntax">();</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="1-mn.html#SP2">&#167;2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2_2" class="paragraph-anchor"></a><b>&#167;2.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Begin with an empty file list and variables dictionary</span><span class="named-paragraph-number">2.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">inter_file_list</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NEW_LINKED_LIST</span><span class="plain-syntax">(</span><span class="reserved-syntax">filename</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">pipeline_vars</span><span class="plain-syntax"> = </span><a href="../pipeline-module/2-pp.html#SP11" class="function-link"><span class="function-syntax">ParsingPipelines::basic_dictionary</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"output.i6"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">internal_path</span><span class="plain-syntax"> = </span><a href="../foundation/3-pth.html#SP5" class="function-link"><span class="function-syntax">Pathnames::from_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"inform7/Internal"</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="1-mn.html#SP2">&#167;2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2_3" class="paragraph-anchor"></a><b>&#167;2.3. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Select the build-kit pipeline</span><span class="named-paragraph-number">2.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_architecture</span><span class="plain-syntax"> *</span><span class="identifier-syntax">A</span><span class="plain-syntax"> = </span><a href="../pipeline-module/1-pm.html#SP4" class="function-link"><span class="function-syntax">PipelineModule::get_architecture</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">A</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><a href="../foundation/3-em.html#SP2" class="function-link"><span class="function-syntax">Errors::fatal</span></a><span class="plain-syntax">(</span><span class="string-syntax">"no -architecture given"</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">pathname</span><span class="plain-syntax"> *</span><span class="identifier-syntax">path_to_pipelines</span><span class="plain-syntax"> = </span><a href="../foundation/3-pth.html#SP4" class="function-link"><span class="function-syntax">Pathnames::down</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">path_to_inter</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"Pipelines"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">pipeline_as_file</span><span class="plain-syntax"> = </span><a href="../foundation/3-fln.html#SP2" class="function-link"><span class="function-syntax">Filenames::in</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">path_to_pipelines</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"build-kit.interpipeline"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">pipeline_as_text</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><a href="1-mn.html#SP1" class="function-link"><span class="function-syntax">Main::add_pipeline_variable</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"*kit"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><a href="../foundation/3-pth.html#SP7" class="function-link"><span class="function-syntax">Pathnames::directory_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">kit_to_build</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><a href="1-mn.html#SP1" class="function-link"><span class="function-syntax">Main::add_pipeline_variable_from_filename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"*out"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><a href="../arch-module/2-arc.html#SP4" class="function-link"><span class="function-syntax">Architectures::canonical_binary</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">kit_to_build</span><span class="plain-syntax">, </span><span class="identifier-syntax">A</span><span class="plain-syntax">));</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="1-mn.html#SP2">&#167;2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2_4" class="paragraph-anchor"></a><b>&#167;2.4. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Run the pipeline</span><span class="named-paragraph-number">2.4</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">pipeline_as_file</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">pipeline_as_text</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><a href="../foundation/3-em.html#SP2" class="function-link"><span class="function-syntax">Errors::fatal</span></a><span class="plain-syntax">(</span><span class="string-syntax">"-pipeline-text and -pipeline-file are mutually exclusive"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="../foundation/4-sm.html#SP8" class="function-link"><span class="function-syntax">Str::len</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">output_format</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">output_format</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"Text"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax"> = </span><a href="../arch-module/2-tvm.html#SP6" class="function-link"><span class="function-syntax">TargetVMs::find</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">output_format</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">VM</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><a href="../foundation/3-em.html#SP2" class="function-link"><span class="function-syntax">Errors::fatal</span></a><span class="plain-syntax">(</span><span class="string-syntax">"unrecognised compilation -format"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_architecture</span><span class="plain-syntax"> *</span><span class="identifier-syntax">A</span><span class="plain-syntax"> = </span><a href="../pipeline-module/1-pm.html#SP4" class="function-link"><span class="function-syntax">PipelineModule::get_architecture</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">A</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="../pipeline-module/1-pm.html#SP4" class="function-link"><span class="function-syntax">PipelineModule::set_architecture</span></a><span class="plain-syntax">(</span>
<span class="plain-syntax">            </span><a href="../arch-module/2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::to_codename</span></a><span class="plain-syntax">(</span><a href="../arch-module/2-tvm.html#SP13" class="function-link"><span class="function-syntax">TargetVMs::get_architecture</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">)));</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax"> = </span><a href="../bytecode-module/2-it.html#SP2" class="function-link"><span class="function-syntax">InterTree::new</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="../foundation/2-llas.html#SP7" class="function-link"><span class="function-syntax">LinkedLists::len</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inter_file_list</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="../foundation/2-llas.html#SP7" class="function-link"><span class="function-syntax">LinkedLists::len</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inter_file_list</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">1</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><a href="../foundation/3-em.html#SP2" class="function-link"><span class="function-syntax">Errors::fatal</span></a><span class="plain-syntax">(</span><span class="string-syntax">"only one file of Inter can be supplied"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">F</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">F</span><span class="plain-syntax">, </span><span class="reserved-syntax">filename</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_file_list</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><a href="1-mn.html#SP1" class="function-link"><span class="function-syntax">Main::add_pipeline_variable_from_filename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"*in"</span><span class="plain-syntax">, </span><span class="identifier-syntax">F</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">output_file</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><a href="1-mn.html#SP1" class="function-link"><span class="function-syntax">Main::add_pipeline_variable_from_filename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"*out"</span><span class="plain-syntax">, </span><span class="identifier-syntax">output_file</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_pipeline</span><span class="plain-syntax"> *</span><span class="identifier-syntax">SS</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="1-mn.html#SP2_4_1" class="named-paragraph-link"><span class="named-paragraph">Compile the pipeline</span><span class="named-paragraph-number">2.4.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">SS</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">req_list</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NEW_LINKED_LIST</span><span class="plain-syntax">(</span><span class="reserved-syntax">attachment_instruction</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="../pipeline-module/2-rp.html#SP3" class="function-link"><span class="function-syntax">RunningPipelines::run</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">domain_path</span><span class="plain-syntax">, </span><span class="identifier-syntax">SS</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">kit_to_build</span><span class="plain-syntax">, </span><span class="identifier-syntax">req_list</span><span class="plain-syntax">, </span><span class="identifier-syntax">VM</span><span class="plain-syntax">, </span><span class="identifier-syntax">tracing</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="1-mn.html#SP2">&#167;2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2_4_1" class="paragraph-anchor"></a><b>&#167;2.4.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Compile the pipeline</span><span class="named-paragraph-number">2.4.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pipeline_as_file</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">SS</span><span class="plain-syntax"> = </span><a href="../pipeline-module/2-pp.html#SP5" class="function-link"><span class="function-syntax">ParsingPipelines::from_file</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pipeline_as_file</span><span class="plain-syntax">, </span><span class="identifier-syntax">pipeline_vars</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">SS</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><a href="../foundation/3-em.html#SP2" class="function-link"><span class="function-syntax">Errors::fatal</span></a><span class="plain-syntax">(</span><span class="string-syntax">"pipeline could not be parsed"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pipeline_as_text</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">SS</span><span class="plain-syntax"> = </span><a href="../pipeline-module/2-pp.html#SP5" class="function-link"><span class="function-syntax">ParsingPipelines::from_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pipeline_as_text</span><span class="plain-syntax">, </span><span class="identifier-syntax">pipeline_vars</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">SS</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><a href="../foundation/3-em.html#SP2" class="function-link"><span class="function-syntax">Errors::fatal</span></a><span class="plain-syntax">(</span><span class="string-syntax">"pipeline could not be parsed"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">output_file</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">SS</span><span class="plain-syntax"> = </span><a href="../pipeline-module/2-pp.html#SP5" class="function-link"><span class="function-syntax">ParsingPipelines::from_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"read &lt;- *in, generate -&gt; *out"</span><span class="plain-syntax">, </span><span class="identifier-syntax">pipeline_vars</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">SS</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><a href="../foundation/3-em.html#SP2" class="function-link"><span class="function-syntax">Errors::fatal</span></a><span class="plain-syntax">(</span><span class="string-syntax">"pipeline could not be parsed"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="../foundation/2-llas.html#SP7" class="function-link"><span class="function-syntax">LinkedLists::len</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">inter_file_list</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">SS</span><span class="plain-syntax"> = </span><a href="../pipeline-module/2-pp.html#SP5" class="function-link"><span class="function-syntax">ParsingPipelines::from_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"read &lt;- *in"</span><span class="plain-syntax">, </span><span class="identifier-syntax">pipeline_vars</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">SS</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><a href="../foundation/3-em.html#SP2" class="function-link"><span class="function-syntax">Errors::fatal</span></a><span class="plain-syntax">(</span><span class="string-syntax">"pipeline could not be parsed"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="1-mn.html#SP2_4">&#167;2.4</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2_5" class="paragraph-anchor"></a><b>&#167;2.5. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Shut down the modules</span><span class="named-paragraph-number">2.5</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><a href="../bytecode-module/1-bm.html#SP3" class="function-link"><span class="function-syntax">BytecodeModule::end</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="../building-module/1-bm2.html#SP5" class="function-link"><span class="function-syntax">BuildingModule::end</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="../pipeline-module/1-pm.html#SP3" class="function-link"><span class="function-syntax">PipelineModule::end</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="../final-module/1-fm2.html#SP3" class="function-link"><span class="function-syntax">FinalModule::end</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="../arch-module/1-am.html#SP3" class="function-link"><span class="function-syntax">ArchModule::end</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="../index-module/1-im.html#SP2" class="function-link"><span class="function-syntax">IndexModule::end</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="1-lm.html#SP3" class="function-link"><span class="function-syntax">LiterateModule::end</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><a href="../foundation/1-fm.html#SP9" class="function-link"><span class="function-syntax">Foundation::end</span></a><span class="plain-syntax">(); </span><span class="comment-syntax"> must be ended last</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="1-mn.html#SP2">&#167;2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP2_6" class="paragraph-anchor"></a><b>&#167;2.6. Command line.</b></p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">PROGRAM_NAME</span><span class="plain-syntax"> </span><span class="string-syntax">"inter"</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">PIPELINE_CLSW</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">PIPELINE_FILE_CLSW</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">PIPELINE_VARIABLE_CLSW</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">DOMAIN_CLSW</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">ARCHITECTURE_CLSW</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">BUILD_KIT_CLSW</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">INTERNAL_CLSW</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">CONSTRUCTS_CLSW</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">ANNOTATIONS_CLSW</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">PRIMITIVES_CLSW</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">FORMAT_CLSW</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">O_CLSW</span>
<span class="definition-keyword">enum</span> <span class="constant-syntax">TRACE_CLSW</span>
</pre>
<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Read the command line</span><span class="named-paragraph-number">2.6</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><a href="../foundation/3-cla.html#SP2" class="function-link"><span class="function-syntax">CommandLine::declare_heading</span></a><span class="plain-syntax">(</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"[[Purpose]]\n\n"</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"usage: inter file1 file2 ... [options]\n"</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><a href="../foundation/3-cla.html#SP5" class="function-link"><span class="function-syntax">CommandLine::declare_switch</span></a><span class="plain-syntax">(</span><span class="constant-syntax">O_CLSW</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"o"</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"code-generate to file X"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="../foundation/3-cla.html#SP6" class="function-link"><span class="function-syntax">CommandLine::declare_textual_switch</span></a><span class="plain-syntax">(</span><span class="constant-syntax">FORMAT_CLSW</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"format"</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"code-generate -o output to format X (default is Text)"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="../foundation/3-cla.html#SP5" class="function-link"><span class="function-syntax">CommandLine::declare_switch</span></a><span class="plain-syntax">(</span><span class="constant-syntax">PIPELINE_CLSW</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"pipeline-text"</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"specify pipeline textually, with X being a comma-separated list of stages"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="../foundation/3-cla.html#SP5" class="function-link"><span class="function-syntax">CommandLine::declare_switch</span></a><span class="plain-syntax">(</span><span class="constant-syntax">PIPELINE_FILE_CLSW</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"pipeline-file"</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"specify pipeline as file X"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="../foundation/3-cla.html#SP5" class="function-link"><span class="function-syntax">CommandLine::declare_switch</span></a><span class="plain-syntax">(</span><span class="constant-syntax">PIPELINE_VARIABLE_CLSW</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"variable"</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"set pipeline variable X (in form name=value)"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="../foundation/3-cla.html#SP5" class="function-link"><span class="function-syntax">CommandLine::declare_switch</span></a><span class="plain-syntax">(</span><span class="constant-syntax">DOMAIN_CLSW</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"domain"</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"specify folder to read/write inter files from/to"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="../foundation/3-cla.html#SP5" class="function-link"><span class="function-syntax">CommandLine::declare_switch</span></a><span class="plain-syntax">(</span><span class="constant-syntax">INTERNAL_CLSW</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"internal"</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"specify folder of internal Inform resources"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="../foundation/3-cla.html#SP5" class="function-link"><span class="function-syntax">CommandLine::declare_switch</span></a><span class="plain-syntax">(</span><span class="constant-syntax">ARCHITECTURE_CLSW</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"architecture"</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"generate Inter with architecture X"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="../foundation/3-cla.html#SP5" class="function-link"><span class="function-syntax">CommandLine::declare_switch</span></a><span class="plain-syntax">(</span><span class="constant-syntax">BUILD_KIT_CLSW</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"build-kit"</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"build Inter kit X for the current architecture"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="../foundation/3-cla.html#SP5" class="function-link"><span class="function-syntax">CommandLine::declare_switch</span></a><span class="plain-syntax">(</span><span class="constant-syntax">CONSTRUCTS_CLSW</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"constructs"</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"print out table of all constructs in the Inter language"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="../foundation/3-cla.html#SP5" class="function-link"><span class="function-syntax">CommandLine::declare_switch</span></a><span class="plain-syntax">(</span><span class="constant-syntax">ANNOTATIONS_CLSW</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"annotations"</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"print out table of all symbol annotations in the Inter language"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="../foundation/3-cla.html#SP5" class="function-link"><span class="function-syntax">CommandLine::declare_switch</span></a><span class="plain-syntax">(</span><span class="constant-syntax">PRIMITIVES_CLSW</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"primitives"</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"print out table of all primitive invocations in the Inter language"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="../foundation/3-cla.html#SP6" class="function-link"><span class="function-syntax">CommandLine::declare_boolean_switch</span></a><span class="plain-syntax">(</span><span class="constant-syntax">TRACE_CLSW</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"trace"</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">U</span><span class="string-syntax">"print out all pipeline steps as they are followed"</span><span class="plain-syntax">, </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><a href="../foundation/3-cla.html#SP8" class="function-link"><span class="function-syntax">CommandLine::read</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">argc</span><span class="plain-syntax">, </span><span class="identifier-syntax">argv</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, &amp;</span><a href="1-mn.html#SP3" class="function-link"><span class="function-syntax">Main::respond</span></a><span class="plain-syntax">, &amp;</span><a href="1-mn.html#SP4" class="function-link"><span class="function-syntax">Main::add_file</span></a><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">path_to_inter</span><span class="plain-syntax"> = </span><a href="../foundation/3-pth.html#SP3" class="function-link"><span class="function-syntax">Pathnames::installation_path</span></a><span class="plain-syntax">(</span><span class="string-syntax">"INTER_PATH"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"inter"</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="1-mn.html#SP2">&#167;2</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Main::respond</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">Main::respond</span></span>:<br/><a href="1-mn.html#SP2_6">&#167;2.6</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">id</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">val</span><span class="plain-syntax">, </span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">arg</span><span class="plain-syntax">, </span><span class="reserved-syntax">void</span><span class="plain-syntax"> *</span><span class="identifier-syntax">state</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">id</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">O_CLSW:</span><span class="plain-syntax"> </span><span class="identifier-syntax">output_file</span><span class="plain-syntax"> = </span><a href="../foundation/3-fln.html#SP3" class="function-link"><span class="function-syntax">Filenames::from_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">arg</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">FORMAT_CLSW:</span><span class="plain-syntax"> </span><span class="identifier-syntax">output_format</span><span class="plain-syntax"> = </span><a href="../foundation/4-sm.html#SP3" class="function-link"><span class="function-syntax">Str::duplicate</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">arg</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">PIPELINE_CLSW:</span><span class="plain-syntax"> </span><span class="identifier-syntax">pipeline_as_text</span><span class="plain-syntax"> = </span><a href="../foundation/4-sm.html#SP3" class="function-link"><span class="function-syntax">Str::duplicate</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">arg</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">PIPELINE_FILE_CLSW:</span><span class="plain-syntax"> </span><span class="identifier-syntax">pipeline_as_file</span><span class="plain-syntax"> = </span><a href="../foundation/3-fln.html#SP3" class="function-link"><span class="function-syntax">Filenames::from_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">arg</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">PIPELINE_VARIABLE_CLSW:</span><span class="plain-syntax"> </span><span class="named-paragraph-container code-font"><a href="1-mn.html#SP3_1" class="named-paragraph-link"><span class="named-paragraph">Add a pipeline variable to the dictionary</span><span class="named-paragraph-number">3.1</span></a></span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">DOMAIN_CLSW:</span><span class="plain-syntax"> </span><span class="identifier-syntax">domain_path</span><span class="plain-syntax"> = </span><a href="../foundation/3-pth.html#SP5" class="function-link"><span class="function-syntax">Pathnames::from_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">arg</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">BUILD_KIT_CLSW:</span><span class="plain-syntax"> </span><span class="identifier-syntax">kit_to_build</span><span class="plain-syntax"> = </span><a href="../foundation/3-pth.html#SP5" class="function-link"><span class="function-syntax">Pathnames::from_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">arg</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">INTERNAL_CLSW:</span><span class="plain-syntax"> </span><span class="identifier-syntax">internal_path</span><span class="plain-syntax"> = </span><a href="../foundation/3-pth.html#SP5" class="function-link"><span class="function-syntax">Pathnames::from_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">arg</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">ARCHITECTURE_CLSW:</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="../pipeline-module/1-pm.html#SP4" class="function-link"><span class="function-syntax">PipelineModule::set_architecture</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">arg</span><span class="plain-syntax">) == </span><span class="constant-syntax">FALSE</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><a href="../foundation/3-em.html#SP2" class="function-link"><span class="function-syntax">Errors::fatal</span></a><span class="plain-syntax">(</span><span class="string-syntax">"no such -architecture"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">CONSTRUCTS_CLSW:</span><span class="plain-syntax">  </span><a href="../bytecode-module/3-ic.html#SP16" class="function-link"><span class="function-syntax">InterInstruction::show_constructs</span></a><span class="plain-syntax">(</span><span class="constant-syntax">STDOUT</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">ANNOTATIONS_CLSW:</span><span class="plain-syntax"> </span><a href="../bytecode-module/2-ann.html#SP5" class="function-link"><span class="function-syntax">SymbolAnnotation::show_annotations</span></a><span class="plain-syntax">(</span><span class="constant-syntax">STDOUT</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">PRIMITIVES_CLSW:</span><span class="plain-syntax">  </span><a href="../building-module/1-ip.html#SP6" class="function-link"><span class="function-syntax">Primitives::show_primitives</span></a><span class="plain-syntax">(</span><span class="constant-syntax">STDOUT</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRACE_CLSW:</span><span class="plain-syntax"> </span><span class="identifier-syntax">tracing</span><span class="plain-syntax"> = (</span><span class="identifier-syntax">val</span><span class="plain-syntax">)?</span><span class="identifier-syntax">TRUE:FALSE</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP3_1" class="paragraph-anchor"></a><b>&#167;3.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Add a pipeline variable to the dictionary</span><span class="named-paragraph-number">3.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">match_results</span><span class="plain-syntax"> </span><span class="identifier-syntax">mr</span><span class="plain-syntax"> = </span><a href="../foundation/4-pm.html#SP9" class="function-link"><span class="function-syntax">Regexp::create_mr</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="../foundation/4-pm.html#SP10" class="function-link"><span class="function-syntax">Regexp::match</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">, </span><span class="identifier-syntax">arg</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"(%c+)=(%c+)"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="../foundation/4-sm.html#SP13" class="function-link"><span class="function-syntax">Str::get_first_char</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">arg</span><span class="plain-syntax">) != </span><span class="character-syntax">'*'</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><a href="../foundation/3-em.html#SP2" class="function-link"><span class="function-syntax">Errors::fatal</span></a><span class="plain-syntax">(</span><span class="string-syntax">"-variable names must begin with '*'"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><a href="1-mn.html#SP1" class="function-link"><span class="function-syntax">Main::add_pipeline_variable</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="element-syntax">exp</span><span class="plain-syntax">[0], </span><span class="identifier-syntax">mr</span><span class="plain-syntax">.</span><span class="element-syntax">exp</span><span class="plain-syntax">[1]);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><a href="../foundation/3-em.html#SP2" class="function-link"><span class="function-syntax">Errors::fatal</span></a><span class="plain-syntax">(</span><span class="string-syntax">"-variable should take the form 'name=value'"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><a href="../foundation/4-pm.html#SP9" class="function-link"><span class="function-syntax">Regexp::dispose_of</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">mr</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="1-mn.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">Main::add_file</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">Main::add_file</span></span>:<br/><a href="1-mn.html#SP2_6">&#167;2.6</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">id</span><span class="plain-syntax">, </span><span class="reserved-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">arg</span><span class="plain-syntax">, </span><span class="reserved-syntax">void</span><span class="plain-syntax"> *</span><span class="identifier-syntax">state</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">F</span><span class="plain-syntax"> = </span><a href="../foundation/3-fln.html#SP3" class="function-link"><span class="function-syntax">Filenames::from_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">arg</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ADD_TO_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">F</span><span class="plain-syntax">, </span><span class="reserved-syntax">filename</span><span class="plain-syntax">, </span><span class="identifier-syntax">inter_file_list</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>The modules included in <span class="extract"><span class="extract-syntax">inter</span></span> make use of the Inform 7 module <span class="extract"><span class="extract-syntax">kinds</span></span>,
but when we are using <span class="extract"><span class="extract-syntax">inter</span></span> on its own, kinds have no meaning for us.
We are required to create a <span class="extract"><span class="extract-syntax">kind</span></span> type, in order for <span class="extract"><span class="extract-syntax">kinds</span></span> to compile;
but no instances of this kind will ever in fact exist. <span class="extract"><span class="extract-syntax">K_value</span></span> is a
global constant meaning "any kind at all", and that also must exist.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="identifier-syntax">kind</span><span class="plain-syntax">;</span>
<span class="identifier-syntax">kind</span><span class="plain-syntax"> *</span><span class="identifier-syntax">K_value</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. </b>This is where the <a href="../html-module/index.html" class="internal">html</a> module can find CSS files and similar resources:
</p>

<pre class="definitions code-font"><span class="definition-keyword">define</span> <span class="constant-syntax">INSTALLED_FILES_HTML_CALLBACK</span><span class="plain-syntax"> </span><a href="1-mn.html#SP6" class="function-link"><span class="function-syntax">Main::internal_path</span></a>
</pre>
<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">pathname</span><span class="plain-syntax"> *</span><span class="function-syntax">Main::internal_path</span><button class="popup" onclick="togglePopup('usagePopup5')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup5">Usage of <span class="code-font"><span class="function-syntax">Main::internal_path</span></span>:<br/><a href="1-mn.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">internal_path</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="M-rc.html">&#10094;</a></li><li class="progresschapter"><a href="M-ui.html">M</a></li><li class="progresscurrentchapter">1</li><li class="progresscurrent">mn</li><li class="progressnextoff">&#10095;</li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

